package oj;

/**
 * @author 郝文雪
 * @date 2022/8/17 19:42
 * @Description Test
 */
public class LC165 {
    public int compareVersion(String version1, String version2) {
        int i=0;
        int j=0;
        while(i<version1.length() || j<version2.length()){
            int x=0;
            for(;i<version1.length()&&version1.charAt(i)!='.';i++){
                x=x*10+version1.charAt(i)-'0';
            }
            i++;
            int y=0;
            for(;j<version2.length()&&version2.charAt(j)!='.';j++){
                y=y*10+version2.charAt(j)-'0';
            }
            j++;
            if(x!=y){
                return x>y?1:-1;
            }
        }
        return 0;
    }
}
